package photobox.photo

import photobox.account.User

class Photo {
    String  name
    Date    picTime //拍摄时间
    Date dateCreated

    String      description  //作品介绍
    String      keywords
    Integer     isRecommend = 0 //是否推荐 1: 推荐 0: 不推荐
    Integer     isDeal //是否委委托交易 1：交易  0：不交易
    Integer     display//是否上架 1：上架 0:下架
    // Integer     settleType         //结算方式
    String      originImagePath    //原图路径
    String      smallImagePath    //小图路径200px
    String      middleImagePath   //中图400px
    String      bigImagePath      //大图800px


    Integer     showShape=1   //图片显示形状 横或竖  为了显示css控制
    static final int SHAPE_HORIZONTAL = 1 //横
    static final int  SHAPE_VERTICAL = 2  //竖

    Integer     laudNum   //点赞总数
    Integer     shareNum   //分享总数
    Integer     saleNum     //销售数
    Float       price       //作者出售价格


    String device               //设备
    static final int ISDEAL_NO = 0
    static final int  ISDEAL_YES = 1


    static belongsTo = [user:User]
    static hasMany = [categories:Category,photoSize:PhotoSize]

    static mapping = {
        table 'pht_photo'
    }

    static constraints = {

        name  size: 0..50
        description  size: 0..600
        keywords  nullable: true, size: 0..200

        isRecommend inList: [0, 1]
        showShape inList: [1, 2]
        isDeal  inList: [ISDEAL_NO, ISDEAL_YES]
        display inList: [0,1]
        laudNum  min: 0, max: Integer.MAX_VALUE
        saleNum  min: 0, max: Integer.MAX_VALUE
        shareNum  min: 0, max: Integer.MAX_VALUE
        saleNum  min: 0, max: Integer.MAX_VALUE

        price scale: 2, min: 0.0f, max: Float.MAX_VALUE

        originImagePath  size: 0..200
        smallImagePath  size: 0..200
        middleImagePath  size: 0..200
        bigImagePath  size: 0..200
    }
}
